package agenda;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class AcessoDbContatoMain {

	public static void main(String[] args) throws Exception {
		String url = "jdbc:oracle:thin:@localhost:1521:xe";
		//String sql = "select id,nome,email,telefone,celular from contato";
		String sql = "select * from FichaFuncionario";
		//try (Connection con = DriverManager.getConnection(url, "ricardoDb", "ricardo");
		try (Connection con = DriverManager.getConnection(url, "estudoDb", "ricardo");		
		PreparedStatement stm = con.prepareStatement(sql);
		ResultSet rs = stm.executeQuery()){
			while(rs.next()){
				System.out.println(rs.getString("nome"));
			}
		}
		
		//rs.close();
		//stm.close();
		//con.close();
		
		
		

	}

}
